// Copyright (c) Lawrence Livermore National Security, LLC and other VisIt
// Project developers.  See the top-level LICENSE file for dates and other
// details.  No copyright assignment is required to contribute to VisIt.

#include <PyMetricThresholdAttributes.h>
#include <ObserverToCallback.h>
#include <stdio.h>
#include <Py2and3Support.h>

// ****************************************************************************
// Module: PyMetricThresholdAttributes
//
// Purpose:
//   This class contains attributes for the MetricThreshold operator.
//
// Note:       Autogenerated by xml2python. Do not modify by hand!
//
// Programmer: xml2python
// Creation:   omitted
//
// ****************************************************************************

//
// This struct contains the Python type information and a MetricThresholdAttributes.
//
struct MetricThresholdAttributesObject
{
    PyObject_HEAD
    MetricThresholdAttributes *data;
    bool        owns;
    PyObject   *parent;
};

//
// Internal prototypes
//
static PyObject *NewMetricThresholdAttributes(int);
std::string
PyMetricThresholdAttributes_ToString(const MetricThresholdAttributes *atts, const char *prefix, const bool forLogging)
{
    std::string str;
    char tmpStr[1000];

    const char *preset_names = "NONE, Aspect_Ratio, Aspect_Gamma, Skew, Taper, "
        "Volume, Stretch, Diagonal, Dimension, "
        "Oddy, Condition, Jacobian, Scaled_Jacobian, "
        "Shear, Shape, Relative_Size, Shape_and_Size, "
        "Area, Warpage, Smallest_Angle, Largest_Angle";
    switch (atts->GetPreset())
    {
      case MetricThresholdAttributes::None:
          snprintf(tmpStr, 1000, "%spreset = %sNONE  # %s\n", prefix, prefix, preset_names);
          str += tmpStr;
          break;
      case MetricThresholdAttributes::Aspect_Ratio:
          snprintf(tmpStr, 1000, "%spreset = %sAspect_Ratio  # %s\n", prefix, prefix, preset_names);
          str += tmpStr;
          break;
      case MetricThresholdAttributes::Aspect_Gamma:
          snprintf(tmpStr, 1000, "%spreset = %sAspect_Gamma  # %s\n", prefix, prefix, preset_names);
          str += tmpStr;
          break;
      case MetricThresholdAttributes::Skew:
          snprintf(tmpStr, 1000, "%spreset = %sSkew  # %s\n", prefix, prefix, preset_names);
          str += tmpStr;
          break;
      case MetricThresholdAttributes::Taper:
          snprintf(tmpStr, 1000, "%spreset = %sTaper  # %s\n", prefix, prefix, preset_names);
          str += tmpStr;
          break;
      case MetricThresholdAttributes::Volume:
          snprintf(tmpStr, 1000, "%spreset = %sVolume  # %s\n", prefix, prefix, preset_names);
          str += tmpStr;
          break;
      case MetricThresholdAttributes::Stretch:
          snprintf(tmpStr, 1000, "%spreset = %sStretch  # %s\n", prefix, prefix, preset_names);
          str += tmpStr;
          break;
      case MetricThresholdAttributes::Diagonal:
          snprintf(tmpStr, 1000, "%spreset = %sDiagonal  # %s\n", prefix, prefix, preset_names);
          str += tmpStr;
          break;
      case MetricThresholdAttributes::Dimension:
          snprintf(tmpStr, 1000, "%spreset = %sDimension  # %s\n", prefix, prefix, preset_names);
          str += tmpStr;
          break;
      case MetricThresholdAttributes::Oddy:
          snprintf(tmpStr, 1000, "%spreset = %sOddy  # %s\n", prefix, prefix, preset_names);
          str += tmpStr;
          break;
      case MetricThresholdAttributes::Condition:
          snprintf(tmpStr, 1000, "%spreset = %sCondition  # %s\n", prefix, prefix, preset_names);
          str += tmpStr;
          break;
      case MetricThresholdAttributes::Jacobian:
          snprintf(tmpStr, 1000, "%spreset = %sJacobian  # %s\n", prefix, prefix, preset_names);
          str += tmpStr;
          break;
      case MetricThresholdAttributes::Scaled_Jacobian:
          snprintf(tmpStr, 1000, "%spreset = %sScaled_Jacobian  # %s\n", prefix, prefix, preset_names);
          str += tmpStr;
          break;
      case MetricThresholdAttributes::Shear:
          snprintf(tmpStr, 1000, "%spreset = %sShear  # %s\n", prefix, prefix, preset_names);
          str += tmpStr;
          break;
      case MetricThresholdAttributes::Shape:
          snprintf(tmpStr, 1000, "%spreset = %sShape  # %s\n", prefix, prefix, preset_names);
          str += tmpStr;
          break;
      case MetricThresholdAttributes::Relative_Size:
          snprintf(tmpStr, 1000, "%spreset = %sRelative_Size  # %s\n", prefix, prefix, preset_names);
          str += tmpStr;
          break;
      case MetricThresholdAttributes::Shape_and_Size:
          snprintf(tmpStr, 1000, "%spreset = %sShape_and_Size  # %s\n", prefix, prefix, preset_names);
          str += tmpStr;
          break;
      case MetricThresholdAttributes::Area:
          snprintf(tmpStr, 1000, "%spreset = %sArea  # %s\n", prefix, prefix, preset_names);
          str += tmpStr;
          break;
      case MetricThresholdAttributes::Warpage:
          snprintf(tmpStr, 1000, "%spreset = %sWarpage  # %s\n", prefix, prefix, preset_names);
          str += tmpStr;
          break;
      case MetricThresholdAttributes::Smallest_Angle:
          snprintf(tmpStr, 1000, "%spreset = %sSmallest_Angle  # %s\n", prefix, prefix, preset_names);
          str += tmpStr;
          break;
      case MetricThresholdAttributes::Largest_Angle:
          snprintf(tmpStr, 1000, "%spreset = %sLargest_Angle  # %s\n", prefix, prefix, preset_names);
          str += tmpStr;
          break;
      default:
          break;
    }

    if(atts->GetHexahedron())
        snprintf(tmpStr, 1000, "%sHexahedron = 1\n", prefix);
    else
        snprintf(tmpStr, 1000, "%sHexahedron = 0\n", prefix);
    str += tmpStr;
    snprintf(tmpStr, 1000, "%shex_lower = %g\n", prefix, atts->GetHex_lower());
    str += tmpStr;
    snprintf(tmpStr, 1000, "%shex_upper = %g\n", prefix, atts->GetHex_upper());
    str += tmpStr;
    if(atts->GetTetrahedron())
        snprintf(tmpStr, 1000, "%sTetrahedron = 1\n", prefix);
    else
        snprintf(tmpStr, 1000, "%sTetrahedron = 0\n", prefix);
    str += tmpStr;
    snprintf(tmpStr, 1000, "%stet_lower = %g\n", prefix, atts->GetTet_lower());
    str += tmpStr;
    snprintf(tmpStr, 1000, "%stet_upper = %g\n", prefix, atts->GetTet_upper());
    str += tmpStr;
    if(atts->GetWedge())
        snprintf(tmpStr, 1000, "%sWedge = 1\n", prefix);
    else
        snprintf(tmpStr, 1000, "%sWedge = 0\n", prefix);
    str += tmpStr;
    snprintf(tmpStr, 1000, "%swed_lower = %g\n", prefix, atts->GetWed_lower());
    str += tmpStr;
    snprintf(tmpStr, 1000, "%swed_upper = %g\n", prefix, atts->GetWed_upper());
    str += tmpStr;
    if(atts->GetPyramid())
        snprintf(tmpStr, 1000, "%sPyramid = 1\n", prefix);
    else
        snprintf(tmpStr, 1000, "%sPyramid = 0\n", prefix);
    str += tmpStr;
    snprintf(tmpStr, 1000, "%spyr_lower = %g\n", prefix, atts->GetPyr_lower());
    str += tmpStr;
    snprintf(tmpStr, 1000, "%spyr_upper = %g\n", prefix, atts->GetPyr_upper());
    str += tmpStr;
    if(atts->GetTriangle())
        snprintf(tmpStr, 1000, "%sTriangle = 1\n", prefix);
    else
        snprintf(tmpStr, 1000, "%sTriangle = 0\n", prefix);
    str += tmpStr;
    snprintf(tmpStr, 1000, "%stri_lower = %g\n", prefix, atts->GetTri_lower());
    str += tmpStr;
    snprintf(tmpStr, 1000, "%stri_upper = %g\n", prefix, atts->GetTri_upper());
    str += tmpStr;
    if(atts->GetQuad())
        snprintf(tmpStr, 1000, "%sQuad = 1\n", prefix);
    else
        snprintf(tmpStr, 1000, "%sQuad = 0\n", prefix);
    str += tmpStr;
    snprintf(tmpStr, 1000, "%squad_lower = %g\n", prefix, atts->GetQuad_lower());
    str += tmpStr;
    snprintf(tmpStr, 1000, "%squad_upper = %g\n", prefix, atts->GetQuad_upper());
    str += tmpStr;
    return str;
}

static PyObject *
MetricThresholdAttributes_Notify(PyObject *self, PyObject *args)
{
    MetricThresholdAttributesObject *obj = (MetricThresholdAttributesObject *)self;
    obj->data->Notify();
    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
MetricThresholdAttributes_SetPreset(PyObject *self, PyObject *args)
{
    MetricThresholdAttributesObject *obj = (MetricThresholdAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    int cval = int(val);

    if ((val == -1 && PyErr_Occurred()) || long(cval) != val)
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ int");
    }

    if (cval < 0 || cval >= 21)
    {
        std::stringstream ss;
        ss << "An invalid preset value was given." << std::endl;
        ss << "Valid values are in the range [0,20]." << std::endl;
        ss << "You can also use the following symbolic names:";
        ss << " None";
        ss << ", Aspect_Ratio";
        ss << ", Aspect_Gamma";
        ss << ", Skew";
        ss << ", Taper";
        ss << ", Volume";
        ss << ", Stretch";
        ss << ", Diagonal";
        ss << ", Dimension";
        ss << ", Oddy";
        ss << ", Condition";
        ss << ", Jacobian";
        ss << ", Scaled_Jacobian";
        ss << ", Shear";
        ss << ", Shape";
        ss << ", Relative_Size";
        ss << ", Shape_and_Size";
        ss << ", Area";
        ss << ", Warpage";
        ss << ", Smallest_Angle";
        ss << ", Largest_Angle";
        return PyErr_Format(PyExc_ValueError, ss.str().c_str());
    }

    Py_XDECREF(packaged_args);

    // Set the preset in the object.
    obj->data->SetPreset(MetricThresholdAttributes::Preset(cval));

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
MetricThresholdAttributes_GetPreset(PyObject *self, PyObject *args)
{
    MetricThresholdAttributesObject *obj = (MetricThresholdAttributesObject *)self;
    PyObject *retval = PyInt_FromLong(long(obj->data->GetPreset()));
    return retval;
}

/*static*/ PyObject *
MetricThresholdAttributes_SetHexahedron(PyObject *self, PyObject *args)
{
    MetricThresholdAttributesObject *obj = (MetricThresholdAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    bool cval = bool(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ bool");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ bool");
    }

    Py_XDECREF(packaged_args);

    // Set the Hexahedron in the object.
    obj->data->SetHexahedron(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
MetricThresholdAttributes_GetHexahedron(PyObject *self, PyObject *args)
{
    MetricThresholdAttributesObject *obj = (MetricThresholdAttributesObject *)self;
    PyObject *retval = PyInt_FromLong(obj->data->GetHexahedron()?1L:0L);
    return retval;
}

/*static*/ PyObject *
MetricThresholdAttributes_SetHex_lower(PyObject *self, PyObject *args)
{
    MetricThresholdAttributesObject *obj = (MetricThresholdAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    double val = PyFloat_AsDouble(args);
    double cval = double(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ double");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(double(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ double");
    }

    Py_XDECREF(packaged_args);

    // Set the hex_lower in the object.
    obj->data->SetHex_lower(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
MetricThresholdAttributes_GetHex_lower(PyObject *self, PyObject *args)
{
    MetricThresholdAttributesObject *obj = (MetricThresholdAttributesObject *)self;
    PyObject *retval = PyFloat_FromDouble(obj->data->GetHex_lower());
    return retval;
}

/*static*/ PyObject *
MetricThresholdAttributes_SetHex_upper(PyObject *self, PyObject *args)
{
    MetricThresholdAttributesObject *obj = (MetricThresholdAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    double val = PyFloat_AsDouble(args);
    double cval = double(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ double");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(double(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ double");
    }

    Py_XDECREF(packaged_args);

    // Set the hex_upper in the object.
    obj->data->SetHex_upper(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
MetricThresholdAttributes_GetHex_upper(PyObject *self, PyObject *args)
{
    MetricThresholdAttributesObject *obj = (MetricThresholdAttributesObject *)self;
    PyObject *retval = PyFloat_FromDouble(obj->data->GetHex_upper());
    return retval;
}

/*static*/ PyObject *
MetricThresholdAttributes_SetTetrahedron(PyObject *self, PyObject *args)
{
    MetricThresholdAttributesObject *obj = (MetricThresholdAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    bool cval = bool(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ bool");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ bool");
    }

    Py_XDECREF(packaged_args);

    // Set the Tetrahedron in the object.
    obj->data->SetTetrahedron(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
MetricThresholdAttributes_GetTetrahedron(PyObject *self, PyObject *args)
{
    MetricThresholdAttributesObject *obj = (MetricThresholdAttributesObject *)self;
    PyObject *retval = PyInt_FromLong(obj->data->GetTetrahedron()?1L:0L);
    return retval;
}

/*static*/ PyObject *
MetricThresholdAttributes_SetTet_lower(PyObject *self, PyObject *args)
{
    MetricThresholdAttributesObject *obj = (MetricThresholdAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    double val = PyFloat_AsDouble(args);
    double cval = double(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ double");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(double(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ double");
    }

    Py_XDECREF(packaged_args);

    // Set the tet_lower in the object.
    obj->data->SetTet_lower(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
MetricThresholdAttributes_GetTet_lower(PyObject *self, PyObject *args)
{
    MetricThresholdAttributesObject *obj = (MetricThresholdAttributesObject *)self;
    PyObject *retval = PyFloat_FromDouble(obj->data->GetTet_lower());
    return retval;
}

/*static*/ PyObject *
MetricThresholdAttributes_SetTet_upper(PyObject *self, PyObject *args)
{
    MetricThresholdAttributesObject *obj = (MetricThresholdAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    double val = PyFloat_AsDouble(args);
    double cval = double(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ double");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(double(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ double");
    }

    Py_XDECREF(packaged_args);

    // Set the tet_upper in the object.
    obj->data->SetTet_upper(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
MetricThresholdAttributes_GetTet_upper(PyObject *self, PyObject *args)
{
    MetricThresholdAttributesObject *obj = (MetricThresholdAttributesObject *)self;
    PyObject *retval = PyFloat_FromDouble(obj->data->GetTet_upper());
    return retval;
}

/*static*/ PyObject *
MetricThresholdAttributes_SetWedge(PyObject *self, PyObject *args)
{
    MetricThresholdAttributesObject *obj = (MetricThresholdAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    bool cval = bool(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ bool");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ bool");
    }

    Py_XDECREF(packaged_args);

    // Set the Wedge in the object.
    obj->data->SetWedge(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
MetricThresholdAttributes_GetWedge(PyObject *self, PyObject *args)
{
    MetricThresholdAttributesObject *obj = (MetricThresholdAttributesObject *)self;
    PyObject *retval = PyInt_FromLong(obj->data->GetWedge()?1L:0L);
    return retval;
}

/*static*/ PyObject *
MetricThresholdAttributes_SetWed_lower(PyObject *self, PyObject *args)
{
    MetricThresholdAttributesObject *obj = (MetricThresholdAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    double val = PyFloat_AsDouble(args);
    double cval = double(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ double");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(double(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ double");
    }

    Py_XDECREF(packaged_args);

    // Set the wed_lower in the object.
    obj->data->SetWed_lower(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
MetricThresholdAttributes_GetWed_lower(PyObject *self, PyObject *args)
{
    MetricThresholdAttributesObject *obj = (MetricThresholdAttributesObject *)self;
    PyObject *retval = PyFloat_FromDouble(obj->data->GetWed_lower());
    return retval;
}

/*static*/ PyObject *
MetricThresholdAttributes_SetWed_upper(PyObject *self, PyObject *args)
{
    MetricThresholdAttributesObject *obj = (MetricThresholdAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    double val = PyFloat_AsDouble(args);
    double cval = double(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ double");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(double(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ double");
    }

    Py_XDECREF(packaged_args);

    // Set the wed_upper in the object.
    obj->data->SetWed_upper(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
MetricThresholdAttributes_GetWed_upper(PyObject *self, PyObject *args)
{
    MetricThresholdAttributesObject *obj = (MetricThresholdAttributesObject *)self;
    PyObject *retval = PyFloat_FromDouble(obj->data->GetWed_upper());
    return retval;
}

/*static*/ PyObject *
MetricThresholdAttributes_SetPyramid(PyObject *self, PyObject *args)
{
    MetricThresholdAttributesObject *obj = (MetricThresholdAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    bool cval = bool(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ bool");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ bool");
    }

    Py_XDECREF(packaged_args);

    // Set the Pyramid in the object.
    obj->data->SetPyramid(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
MetricThresholdAttributes_GetPyramid(PyObject *self, PyObject *args)
{
    MetricThresholdAttributesObject *obj = (MetricThresholdAttributesObject *)self;
    PyObject *retval = PyInt_FromLong(obj->data->GetPyramid()?1L:0L);
    return retval;
}

/*static*/ PyObject *
MetricThresholdAttributes_SetPyr_lower(PyObject *self, PyObject *args)
{
    MetricThresholdAttributesObject *obj = (MetricThresholdAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    double val = PyFloat_AsDouble(args);
    double cval = double(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ double");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(double(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ double");
    }

    Py_XDECREF(packaged_args);

    // Set the pyr_lower in the object.
    obj->data->SetPyr_lower(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
MetricThresholdAttributes_GetPyr_lower(PyObject *self, PyObject *args)
{
    MetricThresholdAttributesObject *obj = (MetricThresholdAttributesObject *)self;
    PyObject *retval = PyFloat_FromDouble(obj->data->GetPyr_lower());
    return retval;
}

/*static*/ PyObject *
MetricThresholdAttributes_SetPyr_upper(PyObject *self, PyObject *args)
{
    MetricThresholdAttributesObject *obj = (MetricThresholdAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    double val = PyFloat_AsDouble(args);
    double cval = double(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ double");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(double(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ double");
    }

    Py_XDECREF(packaged_args);

    // Set the pyr_upper in the object.
    obj->data->SetPyr_upper(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
MetricThresholdAttributes_GetPyr_upper(PyObject *self, PyObject *args)
{
    MetricThresholdAttributesObject *obj = (MetricThresholdAttributesObject *)self;
    PyObject *retval = PyFloat_FromDouble(obj->data->GetPyr_upper());
    return retval;
}

/*static*/ PyObject *
MetricThresholdAttributes_SetTriangle(PyObject *self, PyObject *args)
{
    MetricThresholdAttributesObject *obj = (MetricThresholdAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    bool cval = bool(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ bool");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ bool");
    }

    Py_XDECREF(packaged_args);

    // Set the Triangle in the object.
    obj->data->SetTriangle(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
MetricThresholdAttributes_GetTriangle(PyObject *self, PyObject *args)
{
    MetricThresholdAttributesObject *obj = (MetricThresholdAttributesObject *)self;
    PyObject *retval = PyInt_FromLong(obj->data->GetTriangle()?1L:0L);
    return retval;
}

/*static*/ PyObject *
MetricThresholdAttributes_SetTri_lower(PyObject *self, PyObject *args)
{
    MetricThresholdAttributesObject *obj = (MetricThresholdAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    double val = PyFloat_AsDouble(args);
    double cval = double(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ double");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(double(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ double");
    }

    Py_XDECREF(packaged_args);

    // Set the tri_lower in the object.
    obj->data->SetTri_lower(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
MetricThresholdAttributes_GetTri_lower(PyObject *self, PyObject *args)
{
    MetricThresholdAttributesObject *obj = (MetricThresholdAttributesObject *)self;
    PyObject *retval = PyFloat_FromDouble(obj->data->GetTri_lower());
    return retval;
}

/*static*/ PyObject *
MetricThresholdAttributes_SetTri_upper(PyObject *self, PyObject *args)
{
    MetricThresholdAttributesObject *obj = (MetricThresholdAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    double val = PyFloat_AsDouble(args);
    double cval = double(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ double");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(double(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ double");
    }

    Py_XDECREF(packaged_args);

    // Set the tri_upper in the object.
    obj->data->SetTri_upper(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
MetricThresholdAttributes_GetTri_upper(PyObject *self, PyObject *args)
{
    MetricThresholdAttributesObject *obj = (MetricThresholdAttributesObject *)self;
    PyObject *retval = PyFloat_FromDouble(obj->data->GetTri_upper());
    return retval;
}

/*static*/ PyObject *
MetricThresholdAttributes_SetQuad(PyObject *self, PyObject *args)
{
    MetricThresholdAttributesObject *obj = (MetricThresholdAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    bool cval = bool(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ bool");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ bool");
    }

    Py_XDECREF(packaged_args);

    // Set the Quad in the object.
    obj->data->SetQuad(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
MetricThresholdAttributes_GetQuad(PyObject *self, PyObject *args)
{
    MetricThresholdAttributesObject *obj = (MetricThresholdAttributesObject *)self;
    PyObject *retval = PyInt_FromLong(obj->data->GetQuad()?1L:0L);
    return retval;
}

/*static*/ PyObject *
MetricThresholdAttributes_SetQuad_lower(PyObject *self, PyObject *args)
{
    MetricThresholdAttributesObject *obj = (MetricThresholdAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    double val = PyFloat_AsDouble(args);
    double cval = double(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ double");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(double(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ double");
    }

    Py_XDECREF(packaged_args);

    // Set the quad_lower in the object.
    obj->data->SetQuad_lower(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
MetricThresholdAttributes_GetQuad_lower(PyObject *self, PyObject *args)
{
    MetricThresholdAttributesObject *obj = (MetricThresholdAttributesObject *)self;
    PyObject *retval = PyFloat_FromDouble(obj->data->GetQuad_lower());
    return retval;
}

/*static*/ PyObject *
MetricThresholdAttributes_SetQuad_upper(PyObject *self, PyObject *args)
{
    MetricThresholdAttributesObject *obj = (MetricThresholdAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    double val = PyFloat_AsDouble(args);
    double cval = double(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ double");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(double(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ double");
    }

    Py_XDECREF(packaged_args);

    // Set the quad_upper in the object.
    obj->data->SetQuad_upper(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
MetricThresholdAttributes_GetQuad_upper(PyObject *self, PyObject *args)
{
    MetricThresholdAttributesObject *obj = (MetricThresholdAttributesObject *)self;
    PyObject *retval = PyFloat_FromDouble(obj->data->GetQuad_upper());
    return retval;
}



PyMethodDef PyMetricThresholdAttributes_methods[METRICTHRESHOLDATTRIBUTES_NMETH] = {
    {"Notify", MetricThresholdAttributes_Notify, METH_VARARGS},
    {"SetPreset", MetricThresholdAttributes_SetPreset, METH_VARARGS},
    {"GetPreset", MetricThresholdAttributes_GetPreset, METH_VARARGS},
    {"SetHexahedron", MetricThresholdAttributes_SetHexahedron, METH_VARARGS},
    {"GetHexahedron", MetricThresholdAttributes_GetHexahedron, METH_VARARGS},
    {"SetHex_lower", MetricThresholdAttributes_SetHex_lower, METH_VARARGS},
    {"GetHex_lower", MetricThresholdAttributes_GetHex_lower, METH_VARARGS},
    {"SetHex_upper", MetricThresholdAttributes_SetHex_upper, METH_VARARGS},
    {"GetHex_upper", MetricThresholdAttributes_GetHex_upper, METH_VARARGS},
    {"SetTetrahedron", MetricThresholdAttributes_SetTetrahedron, METH_VARARGS},
    {"GetTetrahedron", MetricThresholdAttributes_GetTetrahedron, METH_VARARGS},
    {"SetTet_lower", MetricThresholdAttributes_SetTet_lower, METH_VARARGS},
    {"GetTet_lower", MetricThresholdAttributes_GetTet_lower, METH_VARARGS},
    {"SetTet_upper", MetricThresholdAttributes_SetTet_upper, METH_VARARGS},
    {"GetTet_upper", MetricThresholdAttributes_GetTet_upper, METH_VARARGS},
    {"SetWedge", MetricThresholdAttributes_SetWedge, METH_VARARGS},
    {"GetWedge", MetricThresholdAttributes_GetWedge, METH_VARARGS},
    {"SetWed_lower", MetricThresholdAttributes_SetWed_lower, METH_VARARGS},
    {"GetWed_lower", MetricThresholdAttributes_GetWed_lower, METH_VARARGS},
    {"SetWed_upper", MetricThresholdAttributes_SetWed_upper, METH_VARARGS},
    {"GetWed_upper", MetricThresholdAttributes_GetWed_upper, METH_VARARGS},
    {"SetPyramid", MetricThresholdAttributes_SetPyramid, METH_VARARGS},
    {"GetPyramid", MetricThresholdAttributes_GetPyramid, METH_VARARGS},
    {"SetPyr_lower", MetricThresholdAttributes_SetPyr_lower, METH_VARARGS},
    {"GetPyr_lower", MetricThresholdAttributes_GetPyr_lower, METH_VARARGS},
    {"SetPyr_upper", MetricThresholdAttributes_SetPyr_upper, METH_VARARGS},
    {"GetPyr_upper", MetricThresholdAttributes_GetPyr_upper, METH_VARARGS},
    {"SetTriangle", MetricThresholdAttributes_SetTriangle, METH_VARARGS},
    {"GetTriangle", MetricThresholdAttributes_GetTriangle, METH_VARARGS},
    {"SetTri_lower", MetricThresholdAttributes_SetTri_lower, METH_VARARGS},
    {"GetTri_lower", MetricThresholdAttributes_GetTri_lower, METH_VARARGS},
    {"SetTri_upper", MetricThresholdAttributes_SetTri_upper, METH_VARARGS},
    {"GetTri_upper", MetricThresholdAttributes_GetTri_upper, METH_VARARGS},
    {"SetQuad", MetricThresholdAttributes_SetQuad, METH_VARARGS},
    {"GetQuad", MetricThresholdAttributes_GetQuad, METH_VARARGS},
    {"SetQuad_lower", MetricThresholdAttributes_SetQuad_lower, METH_VARARGS},
    {"GetQuad_lower", MetricThresholdAttributes_GetQuad_lower, METH_VARARGS},
    {"SetQuad_upper", MetricThresholdAttributes_SetQuad_upper, METH_VARARGS},
    {"GetQuad_upper", MetricThresholdAttributes_GetQuad_upper, METH_VARARGS},
    {NULL, NULL}
};

//
// Type functions
//

static void
MetricThresholdAttributes_dealloc(PyObject *v)
{
   MetricThresholdAttributesObject *obj = (MetricThresholdAttributesObject *)v;
   if(obj->parent != 0)
       Py_DECREF(obj->parent);
   if(obj->owns)
       delete obj->data;
}

static PyObject *MetricThresholdAttributes_richcompare(PyObject *self, PyObject *other, int op);
PyObject *
PyMetricThresholdAttributes_getattr(PyObject *self, char *name)
{
    if(strcmp(name, "preset") == 0)
        return MetricThresholdAttributes_GetPreset(self, NULL);
    if(strcmp(name, "None") == 0)
        return PyInt_FromLong(long(MetricThresholdAttributes::None));
    if(strcmp(name, "NONE") == 0)
        return PyInt_FromLong(long(MetricThresholdAttributes::None));
    if(strcmp(name, "Aspect_Ratio") == 0)
        return PyInt_FromLong(long(MetricThresholdAttributes::Aspect_Ratio));
    if(strcmp(name, "Aspect_Gamma") == 0)
        return PyInt_FromLong(long(MetricThresholdAttributes::Aspect_Gamma));
    if(strcmp(name, "Skew") == 0)
        return PyInt_FromLong(long(MetricThresholdAttributes::Skew));
    if(strcmp(name, "Taper") == 0)
        return PyInt_FromLong(long(MetricThresholdAttributes::Taper));
    if(strcmp(name, "Volume") == 0)
        return PyInt_FromLong(long(MetricThresholdAttributes::Volume));
    if(strcmp(name, "Stretch") == 0)
        return PyInt_FromLong(long(MetricThresholdAttributes::Stretch));
    if(strcmp(name, "Diagonal") == 0)
        return PyInt_FromLong(long(MetricThresholdAttributes::Diagonal));
    if(strcmp(name, "Dimension") == 0)
        return PyInt_FromLong(long(MetricThresholdAttributes::Dimension));
    if(strcmp(name, "Oddy") == 0)
        return PyInt_FromLong(long(MetricThresholdAttributes::Oddy));
    if(strcmp(name, "Condition") == 0)
        return PyInt_FromLong(long(MetricThresholdAttributes::Condition));
    if(strcmp(name, "Jacobian") == 0)
        return PyInt_FromLong(long(MetricThresholdAttributes::Jacobian));
    if(strcmp(name, "Scaled_Jacobian") == 0)
        return PyInt_FromLong(long(MetricThresholdAttributes::Scaled_Jacobian));
    if(strcmp(name, "Shear") == 0)
        return PyInt_FromLong(long(MetricThresholdAttributes::Shear));
    if(strcmp(name, "Shape") == 0)
        return PyInt_FromLong(long(MetricThresholdAttributes::Shape));
    if(strcmp(name, "Relative_Size") == 0)
        return PyInt_FromLong(long(MetricThresholdAttributes::Relative_Size));
    if(strcmp(name, "Shape_and_Size") == 0)
        return PyInt_FromLong(long(MetricThresholdAttributes::Shape_and_Size));
    if(strcmp(name, "Area") == 0)
        return PyInt_FromLong(long(MetricThresholdAttributes::Area));
    if(strcmp(name, "Warpage") == 0)
        return PyInt_FromLong(long(MetricThresholdAttributes::Warpage));
    if(strcmp(name, "Smallest_Angle") == 0)
        return PyInt_FromLong(long(MetricThresholdAttributes::Smallest_Angle));
    if(strcmp(name, "Largest_Angle") == 0)
        return PyInt_FromLong(long(MetricThresholdAttributes::Largest_Angle));

    if(strcmp(name, "Hexahedron") == 0)
        return MetricThresholdAttributes_GetHexahedron(self, NULL);
    if(strcmp(name, "hex_lower") == 0)
        return MetricThresholdAttributes_GetHex_lower(self, NULL);
    if(strcmp(name, "hex_upper") == 0)
        return MetricThresholdAttributes_GetHex_upper(self, NULL);
    if(strcmp(name, "Tetrahedron") == 0)
        return MetricThresholdAttributes_GetTetrahedron(self, NULL);
    if(strcmp(name, "tet_lower") == 0)
        return MetricThresholdAttributes_GetTet_lower(self, NULL);
    if(strcmp(name, "tet_upper") == 0)
        return MetricThresholdAttributes_GetTet_upper(self, NULL);
    if(strcmp(name, "Wedge") == 0)
        return MetricThresholdAttributes_GetWedge(self, NULL);
    if(strcmp(name, "wed_lower") == 0)
        return MetricThresholdAttributes_GetWed_lower(self, NULL);
    if(strcmp(name, "wed_upper") == 0)
        return MetricThresholdAttributes_GetWed_upper(self, NULL);
    if(strcmp(name, "Pyramid") == 0)
        return MetricThresholdAttributes_GetPyramid(self, NULL);
    if(strcmp(name, "pyr_lower") == 0)
        return MetricThresholdAttributes_GetPyr_lower(self, NULL);
    if(strcmp(name, "pyr_upper") == 0)
        return MetricThresholdAttributes_GetPyr_upper(self, NULL);
    if(strcmp(name, "Triangle") == 0)
        return MetricThresholdAttributes_GetTriangle(self, NULL);
    if(strcmp(name, "tri_lower") == 0)
        return MetricThresholdAttributes_GetTri_lower(self, NULL);
    if(strcmp(name, "tri_upper") == 0)
        return MetricThresholdAttributes_GetTri_upper(self, NULL);
    if(strcmp(name, "Quad") == 0)
        return MetricThresholdAttributes_GetQuad(self, NULL);
    if(strcmp(name, "quad_lower") == 0)
        return MetricThresholdAttributes_GetQuad_lower(self, NULL);
    if(strcmp(name, "quad_upper") == 0)
        return MetricThresholdAttributes_GetQuad_upper(self, NULL);


    // Add a __dict__ answer so that dir() works
    if (!strcmp(name, "__dict__"))
    {
        PyObject *result = PyDict_New();
        for (int i = 0; PyMetricThresholdAttributes_methods[i].ml_meth; i++)
            PyDict_SetItem(result,
                PyString_FromString(PyMetricThresholdAttributes_methods[i].ml_name),
                PyString_FromString(PyMetricThresholdAttributes_methods[i].ml_name));
        return result;
    }

    return Py_FindMethod(PyMetricThresholdAttributes_methods, self, name);
}

int
PyMetricThresholdAttributes_setattr(PyObject *self, char *name, PyObject *args)
{
    PyObject NULL_PY_OBJ;
    PyObject *obj = &NULL_PY_OBJ;

    if(strcmp(name, "preset") == 0)
        obj = MetricThresholdAttributes_SetPreset(self, args);
    else if(strcmp(name, "Hexahedron") == 0)
        obj = MetricThresholdAttributes_SetHexahedron(self, args);
    else if(strcmp(name, "hex_lower") == 0)
        obj = MetricThresholdAttributes_SetHex_lower(self, args);
    else if(strcmp(name, "hex_upper") == 0)
        obj = MetricThresholdAttributes_SetHex_upper(self, args);
    else if(strcmp(name, "Tetrahedron") == 0)
        obj = MetricThresholdAttributes_SetTetrahedron(self, args);
    else if(strcmp(name, "tet_lower") == 0)
        obj = MetricThresholdAttributes_SetTet_lower(self, args);
    else if(strcmp(name, "tet_upper") == 0)
        obj = MetricThresholdAttributes_SetTet_upper(self, args);
    else if(strcmp(name, "Wedge") == 0)
        obj = MetricThresholdAttributes_SetWedge(self, args);
    else if(strcmp(name, "wed_lower") == 0)
        obj = MetricThresholdAttributes_SetWed_lower(self, args);
    else if(strcmp(name, "wed_upper") == 0)
        obj = MetricThresholdAttributes_SetWed_upper(self, args);
    else if(strcmp(name, "Pyramid") == 0)
        obj = MetricThresholdAttributes_SetPyramid(self, args);
    else if(strcmp(name, "pyr_lower") == 0)
        obj = MetricThresholdAttributes_SetPyr_lower(self, args);
    else if(strcmp(name, "pyr_upper") == 0)
        obj = MetricThresholdAttributes_SetPyr_upper(self, args);
    else if(strcmp(name, "Triangle") == 0)
        obj = MetricThresholdAttributes_SetTriangle(self, args);
    else if(strcmp(name, "tri_lower") == 0)
        obj = MetricThresholdAttributes_SetTri_lower(self, args);
    else if(strcmp(name, "tri_upper") == 0)
        obj = MetricThresholdAttributes_SetTri_upper(self, args);
    else if(strcmp(name, "Quad") == 0)
        obj = MetricThresholdAttributes_SetQuad(self, args);
    else if(strcmp(name, "quad_lower") == 0)
        obj = MetricThresholdAttributes_SetQuad_lower(self, args);
    else if(strcmp(name, "quad_upper") == 0)
        obj = MetricThresholdAttributes_SetQuad_upper(self, args);

    if (obj != NULL && obj != &NULL_PY_OBJ)
        Py_DECREF(obj);

    if (obj == &NULL_PY_OBJ)
    {
        obj = NULL;
        PyErr_Format(PyExc_NameError, "name '%s' is not defined", name);
    }
    else if (obj == NULL && !PyErr_Occurred())
        PyErr_Format(PyExc_RuntimeError, "unknown problem with '%s'", name);

    return (obj != NULL) ? 0 : -1;
}

static int
MetricThresholdAttributes_print(PyObject *v, FILE *fp, int flags)
{
    MetricThresholdAttributesObject *obj = (MetricThresholdAttributesObject *)v;
    fprintf(fp, "%s", PyMetricThresholdAttributes_ToString(obj->data, "",false).c_str());
    return 0;
}

PyObject *
MetricThresholdAttributes_str(PyObject *v)
{
    MetricThresholdAttributesObject *obj = (MetricThresholdAttributesObject *)v;
    return PyString_FromString(PyMetricThresholdAttributes_ToString(obj->data,"", false).c_str());
}

//
// The doc string for the class.
//
#if PY_MAJOR_VERSION > 2 || (PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 5)
static const char *MetricThresholdAttributes_Purpose = "This class contains attributes for the MetricThreshold operator.";
#else
static char *MetricThresholdAttributes_Purpose = "This class contains attributes for the MetricThreshold operator.";
#endif

//
// Python Type Struct Def Macro from Py2and3Support.h
//
//         VISIT_PY_TYPE_OBJ( VPY_TYPE,
//                            VPY_NAME,
//                            VPY_OBJECT,
//                            VPY_DEALLOC,
//                            VPY_PRINT,
//                            VPY_GETATTR,
//                            VPY_SETATTR,
//                            VPY_STR,
//                            VPY_PURPOSE,
//                            VPY_RICHCOMP,
//                            VPY_AS_NUMBER)

//
// The type description structure
//

VISIT_PY_TYPE_OBJ(MetricThresholdAttributesType,         \
                  "MetricThresholdAttributes",           \
                  MetricThresholdAttributesObject,       \
                  MetricThresholdAttributes_dealloc,     \
                  MetricThresholdAttributes_print,       \
                  PyMetricThresholdAttributes_getattr,   \
                  PyMetricThresholdAttributes_setattr,   \
                  MetricThresholdAttributes_str,         \
                  MetricThresholdAttributes_Purpose,     \
                  MetricThresholdAttributes_richcompare, \
                  0); /* as_number*/

//
// Helper function for comparing.
//
static PyObject *
MetricThresholdAttributes_richcompare(PyObject *self, PyObject *other, int op)
{
    // only compare against the same type 
    if ( Py_TYPE(self) != &MetricThresholdAttributesType
         || Py_TYPE(other) != &MetricThresholdAttributesType)
    {
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    }

    PyObject *res = NULL;
    MetricThresholdAttributes *a = ((MetricThresholdAttributesObject *)self)->data;
    MetricThresholdAttributes *b = ((MetricThresholdAttributesObject *)other)->data;

    switch (op)
    {
       case Py_EQ:
           res = (*a == *b) ? Py_True : Py_False;
           break;
       case Py_NE:
           res = (*a != *b) ? Py_True : Py_False;
           break;
       default:
           res = Py_NotImplemented;
           break;
    }

    Py_INCREF(res);
    return res;
}

//
// Helper functions for object allocation.
//

static MetricThresholdAttributes *defaultAtts = 0;
static MetricThresholdAttributes *currentAtts = 0;

static PyObject *
NewMetricThresholdAttributes(int useCurrent)
{
    MetricThresholdAttributesObject *newObject;
    newObject = PyObject_NEW(MetricThresholdAttributesObject, &MetricThresholdAttributesType);
    if(newObject == NULL)
        return NULL;
    if(useCurrent && currentAtts != 0)
        newObject->data = new MetricThresholdAttributes(*currentAtts);
    else if(defaultAtts != 0)
        newObject->data = new MetricThresholdAttributes(*defaultAtts);
    else
        newObject->data = new MetricThresholdAttributes;
    newObject->owns = true;
    newObject->parent = 0;
    return (PyObject *)newObject;
}

static PyObject *
WrapMetricThresholdAttributes(const MetricThresholdAttributes *attr)
{
    MetricThresholdAttributesObject *newObject;
    newObject = PyObject_NEW(MetricThresholdAttributesObject, &MetricThresholdAttributesType);
    if(newObject == NULL)
        return NULL;
    newObject->data = (MetricThresholdAttributes *)attr;
    newObject->owns = false;
    newObject->parent = 0;
    return (PyObject *)newObject;
}

///////////////////////////////////////////////////////////////////////////////
//
// Interface that is exposed to the VisIt module.
//
///////////////////////////////////////////////////////////////////////////////

PyObject *
MetricThresholdAttributes_new(PyObject *self, PyObject *args)
{
    int useCurrent = 0;
    if (!PyArg_ParseTuple(args, "i", &useCurrent))
    {
        if (!PyArg_ParseTuple(args, ""))
            return NULL;
        else
            PyErr_Clear();
    }

    return (PyObject *)NewMetricThresholdAttributes(useCurrent);
}

//
// Plugin method table. These methods are added to the visitmodule's methods.
//
static PyMethodDef MetricThresholdAttributesMethods[] = {
    {"MetricThresholdAttributes", MetricThresholdAttributes_new, METH_VARARGS},
    {NULL,      NULL}        /* Sentinel */
};

static Observer *MetricThresholdAttributesObserver = 0;

std::string
PyMetricThresholdAttributes_GetLogString()
{
    std::string s("MetricThresholdAtts = MetricThresholdAttributes()\n");
    if(currentAtts != 0)
        s += PyMetricThresholdAttributes_ToString(currentAtts, "MetricThresholdAtts.", true);
    return s;
}

static void
PyMetricThresholdAttributes_CallLogRoutine(Subject *subj, void *data)
{
    typedef void (*logCallback)(const std::string &);
    logCallback cb = (logCallback)data;

    if(cb != 0)
    {
        std::string s("MetricThresholdAtts = MetricThresholdAttributes()\n");
        s += PyMetricThresholdAttributes_ToString(currentAtts, "MetricThresholdAtts.", true);
        cb(s);
    }
}

void
PyMetricThresholdAttributes_StartUp(MetricThresholdAttributes *subj, void *data)
{
    if(subj == 0)
        return;

    currentAtts = subj;
    PyMetricThresholdAttributes_SetDefaults(subj);

    //
    // Create the observer that will be notified when the attributes change.
    //
    if(MetricThresholdAttributesObserver == 0)
    {
        MetricThresholdAttributesObserver = new ObserverToCallback(subj,
            PyMetricThresholdAttributes_CallLogRoutine, (void *)data);
    }

}

void
PyMetricThresholdAttributes_CloseDown()
{
    delete defaultAtts;
    defaultAtts = 0;
    delete MetricThresholdAttributesObserver;
    MetricThresholdAttributesObserver = 0;
}

PyMethodDef *
PyMetricThresholdAttributes_GetMethodTable(int *nMethods)
{
    *nMethods = 1;
    return MetricThresholdAttributesMethods;
}

bool
PyMetricThresholdAttributes_Check(PyObject *obj)
{
    return (obj->ob_type == &MetricThresholdAttributesType);
}

MetricThresholdAttributes *
PyMetricThresholdAttributes_FromPyObject(PyObject *obj)
{
    MetricThresholdAttributesObject *obj2 = (MetricThresholdAttributesObject *)obj;
    return obj2->data;
}

PyObject *
PyMetricThresholdAttributes_New()
{
    return NewMetricThresholdAttributes(0);
}

PyObject *
PyMetricThresholdAttributes_Wrap(const MetricThresholdAttributes *attr)
{
    return WrapMetricThresholdAttributes(attr);
}

void
PyMetricThresholdAttributes_SetParent(PyObject *obj, PyObject *parent)
{
    MetricThresholdAttributesObject *obj2 = (MetricThresholdAttributesObject *)obj;
    obj2->parent = parent;
}

void
PyMetricThresholdAttributes_SetDefaults(const MetricThresholdAttributes *atts)
{
    if(defaultAtts)
        delete defaultAtts;

    defaultAtts = new MetricThresholdAttributes(*atts);
}

